package com.yakaten.utils;

import java.util.Enumeration;
import java.util.Hashtable;

public class HtmlDecoder {
	static Hashtable<String,String> html_specialchars_table = new Hashtable<String,String>();
	static {
	        html_specialchars_table.put("&lt;","<");
	        html_specialchars_table.put("&gt;",">");
	        html_specialchars_table.put("&amp;","&");
	        html_specialchars_table.put("&quot;","\"");
	        html_specialchars_table.put("&nbsp;"," ");
	        html_specialchars_table.put("&#039;","'");
	}

	public static String decode(String s){
        Enumeration<String> en = html_specialchars_table.keys();
        while(en.hasMoreElements()){
                String key = (String)en.nextElement();
                String val = (String)html_specialchars_table.get(key);
                s = s.replaceAll(key, val);
        }
        return s;
}
}
